fn main() {
	// a match statement is a shorter way to write a sequence of if-else statements
	// when a matching branch is found, the following statement block will be run
	// the else branch will be run when no other branches match
	os := 'windows'
	print('V is running on ')
	match os {
		'darwin' { println('macOS.') }
		'linux' { println('Linux.') }
		else { println(os) }
	}
	
	// a match expression returns the value of the final expression from the matching branch
	number := 2
	s := match number {
		1 { 'one' }
		2 { 'two' }
		else { 'many' }
	}
	println(s)
	
	println(is_red_or_blud(Color.red))
	
	// use ranges as match patterns
	// if the value falls within the range of a branch, that branch will be executed
	// the ranges use ...(three dots, inclusive) rather than ..(two dots, exclusive)
	c := `v`
	typ := match c {
		`0`...`9` { 'digit' }
		`A`...`Z` { 'uppercase' }
		`a`...`z` { 'lowercase' }
		else { 'other' }
	}
	println(typ) // 'lowercase'
}

enum Color {
	red
	blue
	green
}

fn is_red_or_blud(c Color) bool {
	return match c {
		.red, .blue { true } // comma can be used to test multiple values
		.green { false }
		// an else branch is not allowed when all the branches are exhaustive
	}
}
